<?php

use yii\widgets\LinkPager;
use yii\helpers\Html;
use yii\helpers\Url;

?>
<div style="height:5px"></div>

    <table id="dnd-example" cellspacing="0" class="table table-striped table-hover">
        <thead>
            <tr>
                <th style="width:80px;">ID</th>
                <th>相册ID</th>
                <th>相册名称</th>
                <th>照片描述</th>
                <th>上传地点</th>
                <th>上传时间</th>
				<th align="center">操作</th>
            </tr>
        </thead>

        <tbody>

            <?php
            $users=$dataProvider->getModels();  

            foreach($users as $user)
            {
            ?>
            <tr id="user_<?=$user->id;?>">
                <td><?= $user->id;?></td>
                <td><?= $user->album_id;?></td>
                <td><?= $user->album_id;?></td>
                <td><?= $user->description;?></td>
                <td><?=$user->address?></td>
                <td><?=date('Y-m-d H:i:s',$user->inputtime);?></td>
                <td>
                    <a onclick="del(<?=$user->id?>)">
                        <button type="button" class="btn btn-danger">删除</button>
                    </a>
                </td>
            </tr>
                    
            <?php }?>
        </tbody>
        </table> 

<?php 
$pages=$dataProvider->getPagination();
echo LinkPager::widget([
    'pagination' => $pages,
    ]);

?>
<?php $this->beginBlock('opt') ?>
//    
function del(id)
{
    layer.confirm(
    '确定删除照片？',
    {icon: 5, title:'删除'},
    function(index){
        $.get("<?=Url::toRoute(['album/delete-picture'])?>", {id:id},
        function(data){
			layer.msg(data.msg);
			location.reload();
		});
		layer.close(index);
    });
}
<?php $this->endBlock() ?>
<?php $this->registerJs($this->blocks['opt'], \yii\web\View::POS_END);?>